// JavaScript Document
function openWindowStatusChange(){
	var screenStatusChange = document.getElementById("windowStatusChange");
	var btn = document.getElementById("btnMenuStatusChange");
		if(btn.innerHTML=="▼"){
			btn.innerHTML = "▲";
			screenStatusChange.style.display = "block";
		}else{
			btn.innerHTML = "▼";
			screenStatusChange.style.display = "none";
		}
		
}

function addSupplyInputStatusChoosen(){
	var selectStatus = document.getElementById("SelectBoxStatusChange");
	var supplyStatusMsg = document.getElementById("supplyStatusMsg");
		if(selectStatus.value=="Absent"){
			supplyStatusMsg.style.display = "block";
		}else{
			supplyStatusMsg.style.display = "none";
		}
}

function goStatusChange(){
	var selectStatus = document.getElementById("SelectBoxStatusChange");
	var supplyStatusMsg = document.getElementById("supplyStatusMsgInput");
	if(selectStatus.value!="Absent")
		supplyStatusMsg.value = "";
		
	var xhr = new Ajax();
	xhr.send("./modules/membre/jsaction/status.php?action=update",xhr.ParseData({"status":selectStatus.value,"supplyStatusMsg":supplyStatusMsg.value}),"post");
		openWindowStatusChange();
		getStatus();
	
}

function getStatus(){
	var status = document.getElementById("showStatusBox");
	var xhr = new Ajax();
	xhr.send("./modules/membre/jsaction/status.php?action=get",null,"post");
	var servReponse = xhr.getResponse();
	var reponse = JSON.parse(servReponse);
		if(typeof(reponse.status)=="undefined")
			status.innerHTML = 'Status indeterminé';
		else
			status.innerHTML = reponse.status;
}